<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>ftsave</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="ftmorf.html" title="ftmorf" />
    <link rel="next" href="ftsavek.html" title="ftsavek" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">ftsave</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="ftmorf.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="ftsavek.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="ftsave"></a>
      <div class="titlepage"></div>
      <a id="IndexFtsave" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">ftsave</span>
        </h2>
        <p>ftsave — 
      Save a set of previously-allocated tables to a file.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp111978464"></a>
        <h2>Description</h2>
        <p>
      Save a set of previously-allocated tables to a file.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp111979824"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>ftsave</strong></span> "filename", iflag, ifn1 [, ifn2] [...]</pre>
      </div>
      <div class="refsect1">
        <a id="idp112054704"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>"filename"</em></span> -- A quoted string containing the name of the file to save.
    </p>
        <p>
      <span class="emphasis"><em>iflag</em></span> -- Type of the file to save. (0 = binary file, Non-zero = text file)
    </p>
        <p>
      <span class="emphasis"><em>ifn1, ifn2, ...</em></span> -- Numbers of tables to save.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112058384"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ftsave</em></span> saves a list of tables to a file. The file's format can be binary or text.
    </p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning: Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        The file's format is not compatible with a WAV-file and is not endian-safe.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp112061600"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the ftsave opcode. It uses the file <a class="ulink" href="examples/ftsave.csd" target="_top"><em class="citetitle">ftsave.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp112063376"></a>
          <p class="title">
            <strong>Example 338. Example of the ftsave opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac           -iadc    <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o ftsave.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Table #1, make a sine wave using the GEN10 routine.</span>
gitmp1 <span class="ohdr">ftgen</span> 1, 0, 32768, 10, 1
<span class="comment">; Table #2, create an empty table.</span>
gitmp2 <span class="ohdr">ftgen</span> 2, 0, 32768, 7, 0, 32768, 0

<span class="comment">; Instrument #1 - a basic oscillator.</span>
<span class="oblock">instr</span> 1
  kamp <span class="op">=</span> 20000
  kcps <span class="op">=</span> 440
  <span class="comment">; Use Table #1.</span>
  ifn <span class="op">=</span> 1

  a1 <span class="opc">oscil</span> kamp, kcps, ifn
  <span class="opc">out</span> a1
<span class="oblock">endin</span>


<span class="comment">; Instrument #2 - Load Table #1 into Table #2.</span>
<span class="oblock">instr</span> 2
  <span class="comment">; Save Table #1 to a file called "table1.ftsave".</span>
  <span class="opc">ftsave</span> "table1.ftsave", 0, 1

  <span class="comment">; Load the "table1.ftsave" file into Table #2.</span>
  <span class="opc">ftload</span> "table1.ftsave", 0, 2

  kamp <span class="op">=</span> 20000
  kcps <span class="op">=</span> 440
  <span class="comment">; Use Table #2, it should contain Table #1's sine wave now.</span>
  ifn <span class="op">=</span> 2

  a1 <span class="opc">oscil</span> kamp, kcps, ifn
  <span class="opc">out</span> a1
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Play Instrument #1 for 1 second.</span>
<span class="stamnt">i</span> 1 0 1
<span class="comment">; Play Instrument #2 for 1 second.</span>
<span class="stamnt">i</span> 2 2 1
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112067696"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="ftloadk.html" title="ftloadk"><em class="citetitle">ftloadk</em></a>,
      <a class="link" href="ftload.html" title="ftload"><em class="citetitle">ftload</em></a>,
      <a class="link" href="ftsavek.html" title="ftsavek"><em class="citetitle">ftsavek</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112071728"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>Example written by Kevin Conder.</p>
        <p>New in version 4.21</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="ftmorf.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="ftsavek.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">ftmorf </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> ftsavek</td>
        </tr>
      </table>
    </div>
  </body>
</html>
